"""
@Author: 霍格沃兹测试开发学社-西西
@Desc: 更多测试开发技术探讨，请访问：https://ceshiren.com/t/topic/15860
"""
# a = 1
#
# def func():
#     aa = 2
#
# # print(aa)
#
# print("aaa")
#
# mylist = [1,2,3]
# mylist[5]
#
# # mydic = {"a":1,"b":2}
# # mydic['c']
#
# assert False

def get_num(num):
    try:
        # 正常执行的语句块代码
        mylist = [1,2,3]
        return mylist[num]
    except:
        # 发生异常了，要执行的语句块代码
        print("报错啦，重试一下吧")
    finally:
        # 发生异常或者未发生异常都需要走这个分支
        print("结束啦")

def div(a,b):
    try:
        result = a/b
        return result
    except ZeroDivisionError:
        print("除数为0")
        raise ZeroDivisionError("这是我自己抛出的异常")


print(div(1, 1))
print(div(1, 0))